package com.itgaoshu.hospitalproject.mapper;

import com.itgaoshu.hospitalproject.bean.Finance;
import com.itgaoshu.hospitalproject.bean.SdoctorDuibi;
import com.itgaoshu.hospitalproject.bean.currentFinance;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface FinanceMapper {

    //门诊月收入统计
    List<Double> reportYearFinance(String year);

    //住院月收入统计
    List<Double> zhuYuanYearFinance(String year);

    //门诊年收入统计
    @Select("select sum(repicetotal) value,DATE_FORMAT(ctime,'%Y') name from cashier c,report r where c.reportId=r.reportId and (r.state=0 or r.state=1 or r.state=2 or r.state=3 or r.state=4 or r.state=5) GROUP BY DATE_FORMAT(ctime,'%Y')")
    List<Finance> reportYearBingFinance();

    //住院年收入统计
    @Select("select sum(price) value,DATE_FORMAT(endDate,'%Y') name from register where state=1 group by DATE_FORMAT(endDate,'%Y')")
    List<Finance> zhuYuanYearBingFinance();

    //门诊医生统计对比
    List<SdoctorDuibi> doctorDuibi(SdoctorDuibi sdoctorDuibi);

    //住院医生统计对比
    List<SdoctorDuibi> zDoctorDuibi(SdoctorDuibi sdoctorDuibi);

    //门诊当天统计
    @Select("select sum(c.repicetotal) value, c.durgname name from cashier c,report r  where DATE_FORMAT(ctime,\"%Y-%m-%d\")=#{value} and c.reportId=r.reportId and (r.state=0 or r.state=1 or r.state=2 OR r.state=3 or r.state=4 or r.state=5)  and DATE_FORMAT(ctime,\"%Y-%m-%d\")=#{value} and c.reportId=r.reportId GROUP BY c.durgname")
    List<currentFinance> currentFinance(String current);
}
